package cn.ht.jywrwater.module.ht.dal.mysql.watersurvey;

import java.util.*;

import cn.ht.jywrwater.framework.common.pojo.PageResult;
import cn.ht.jywrwater.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.ht.jywrwater.framework.mybatis.core.mapper.BaseMapperX;
import cn.ht.jywrwater.module.ht.dal.dataobject.watersurvey.WaterSurveyDO;
import org.apache.ibatis.annotations.Mapper;
import cn.ht.jywrwater.module.ht.controller.admin.watersurvey.vo.*;

/**
 * 运行监测概览 Mapper
 *
 * @author hzx
 */
@Mapper
public interface WaterSurveyMapper extends BaseMapperX<WaterSurveyDO> {

    default PageResult<WaterSurveyDO> selectPage(WaterSurveyPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<WaterSurveyDO>()
                .likeIfPresent(WaterSurveyDO::getName, reqVO.getName())
                .eqIfPresent(WaterSurveyDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(WaterSurveyDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(WaterSurveyDO::getType, reqVO.getType())
                .orderByDesc(WaterSurveyDO::getId));
    }

    default List<WaterSurveyDO> selectList(WaterSurveyExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<WaterSurveyDO>()
                .likeIfPresent(WaterSurveyDO::getName, reqVO.getName())
                .eqIfPresent(WaterSurveyDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(WaterSurveyDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(WaterSurveyDO::getType, reqVO.getType())
                .orderByDesc(WaterSurveyDO::getId));
    }

}
